Passed
Pull Request — dev (#313)
by Tristan
06:51
created

__webpack_require__.i   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 1
Ratio 100 %

Importance

Changes 0
Metric Value
eloc 1
dl 1
loc 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1 View Code Duplication
/******/ (function(modules) { // webpackBootstrap
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2
/******/ 	// The module cache
3
/******/ 	var installedModules = {};
4
/******/
5
/******/ 	// The require function
6
/******/ 	function __webpack_require__(moduleId) {
7
/******/
8
/******/ 		// Check if module is in cache
9
/******/ 		if(installedModules[moduleId])
10
/******/ 			return installedModules[moduleId].exports;
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
11
/******/
12
/******/ 		// Create a new module (and put it into the cache)
13
/******/ 		var module = installedModules[moduleId] = {
14
/******/ 			i: moduleId,
15
/******/ 			l: false,
16
/******/ 			exports: {}
17
/******/ 		};
18
/******/
19
/******/ 		// Execute the module function
20
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
/******/
22
/******/ 		// Flag the module as loaded
23
/******/ 		module.l = true;
24
/******/
25
/******/ 		// Return the exports of the module
26
/******/ 		return module.exports;
27
/******/ 	}
28
/******/
29
/******/
30
/******/ 	// expose the modules object (__webpack_modules__)
31
/******/ 	__webpack_require__.m = modules;
32
/******/
33
/******/ 	// expose the module cache
34
/******/ 	__webpack_require__.c = installedModules;
35
/******/
36
/******/ 	// identity function for calling harmony imports with the correct context
37
/******/ 	__webpack_require__.i = function(value) { return value; };
38
/******/
39
/******/ 	// define getter function for harmony exports
40
/******/ 	__webpack_require__.d = function(exports, name, getter) {
41
/******/ 		if(!__webpack_require__.o(exports, name)) {
42
/******/ 			Object.defineProperty(exports, name, {
43
/******/ 				configurable: false,
44
/******/ 				enumerable: true,
45
/******/ 				get: getter
46
/******/ 			});
47
/******/ 		}
48
/******/ 	};
49
/******/
50
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
51
/******/ 	__webpack_require__.n = function(module) {
52
/******/ 		var getter = module && module.__esModule ?
53
/******/ 			function getDefault() { return module['default']; } :
54
/******/ 			function getModuleExports() { return module; };
55
/******/ 		__webpack_require__.d(getter, 'a', getter);
56
/******/ 		return getter;
57
/******/ 	};
58
/******/
59
/******/ 	// Object.prototype.hasOwnProperty.call
60
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
61
/******/
62
/******/ 	// __webpack_public_path__
63
/******/ 	__webpack_require__.p = "./";
64
/******/
65
/******/ 	// Load entry module and return exports
66
/******/ 	return __webpack_require__(__webpack_require__.s = 4);
67
/******/ })
68
/************************************************************************/
69
/******/ ([
70
/* 0 */
71 View Code Duplication
/***/ (function(module, exports) {
0 ignored issues
show
Unused Code introduced by
The parameter exports is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter module is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
72
73
// =============================================================================
74
75
// Utilities JavaScript (jQuery)
76
77
// =============================================================================
78
79
(function ($) {
80
81
                    // Add isValid()
82
83
                    $.fn.isValid = function () {
84
                                        return this[0].checkValidity();
85
                    };
86
87
                    $(document).ready(function () {
88
89
                                        // Accordion Handlers ==================================================
90
91
                                        function accordionTrigger(trigger) {
92
                                                            if ($(trigger).parent(".accordion").hasClass("active")) {
93
                                                                                $(trigger).attr("aria-expanded", "false");
94
                                                                                $(trigger).parent(".accordion").removeClass("active");
95
                                                                                $(trigger).parent(".accordion").find(".accordion-content").attr("aria-hidden", "true");
96
                                                            } else {
97
                                                                                $(trigger).attr("aria-expanded", "true");
98
                                                                                $(trigger).parent(".accordion").addClass("active");
99
                                                                                $(trigger).parent(".accordion").find(".accordion-content").attr("aria-hidden", "false");
100
                                                            }
101
                                        }
102
103
                                        $(document).on("click", ".accordion-trigger", function (e) {
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
104
105
                                                            accordionTrigger(this);
106
                                        });
107
108
                                        $(document).on("keyup", ".accordion-trigger", function (e) {
109
110
                                                            if (e.which == 13) {
111
                                                                                accordionTrigger(this);
112
                                                            }
113
                                        });
114
115
                                        // Modal Handlers ======================================================
116
117
                                        function openModal(trigger) {
118
119
                                                            var modalID = $(trigger).attr("data-modal-id");
120
                                                            var modal = $(".modal[data-modal-id=" + modalID + "]");
121
                                                            $(".modal-overlay").addClass("active");
122
                                                            modal.addClass("active");
123
                                                            $("body").css("overflow", "hidden");
124
125
                                                            // Tab Items
126
127
                                                            var focusableItems = modal.find(":focusable");
128
129
                                                            var firstInput = focusableItems.first();
130
                                                            var lastInput = focusableItems.last();
131
132
                                                            if (modal.find("form").length == 0) {
0 ignored issues
show
Best Practice introduced by
Comparing modal.find("form").length to 0 using the == operator is not safe. Consider using === instead.
Loading history...
133
                                                                                lastInput.focus();
134
                                                            } else {
135
                                                                                firstInput.focus();
136
                                                            }
137
138
                                                            modalTabHandler(firstInput, lastInput);
139
                                                            escapeModalHandler();
140
                                        }
141
142
                                        $(document).on("click", ".modal-trigger", function (e) {
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
143
144
                                                            openModal(this);
145
                                        });
146
147
                                        $(document).on("keyup", ".modal-trigger", function (e) {
148
149
                                                            if (e.which == 13) {
150
                                                                                openModal(this);
151
                                                            }
152
                                        });
153
154
                                        function closeModal(trigger) {
0 ignored issues
show
Unused Code introduced by
The parameter trigger is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
155
156
                                                            $(".modal-overlay").removeClass("active");
157
                                                            $(".modal").removeClass("active");
158
                                                            $("body").css("overflow", "visible");
159
                                        }
160
161
                                        $(document).on("click", ".modal-cancel-trigger", function (e) {
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
162
163
                                                            closeModal(this);
164
                                        });
165
166
                                        $(document).on("keyup", ".modal-cancel-trigger", function (e) {
167
168
                                                            if (e.which == 13) {
169
                                                                                closeModal(this);
170
                                                            }
171
                                        });
172
173
                                        // Tab Handler =====================================================
174
175
                                        function modalTabHandler(first, last) {
176
177
                                                            $(document).on("keydown", function (e) {
178
179
                                                                                var keyCode = e.keyCode || e.which;
180
181
                                                                                if (keyCode == 9 && !e.shiftKey) {
182
183
                                                                                                    if ($(last).is(":focus")) {
184
                                                                                                                        e.preventDefault();
185
                                                                                                                        $(first).focus();
186
                                                                                                    }
187
                                                                                } else if (keyCode == 9 && e.shiftKey) {
188
189
                                                                                                    if ($(first).is(":focus")) {
190
                                                                                                                        e.preventDefault();
191
                                                                                                                        $(last).focus();
192
                                                                                                    }
193
                                                                                }
194
                                                            });
195
                                        }
196
197
                                        // Escape Handler ==================================================
198
199
                                        function escapeModalHandler() {
200
201
                                                            $(document).on("keyup", function (e) {
202
203
                                                                                if (e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27) {
204
205
                                                                                                    $(".modal-overlay").removeClass("active");
206
                                                                                                    $(".modal").removeClass("active");
207
                                                                                                    $("body").css("overflow", "visible");
208
209
                                                                                                    // FF and compatible
210
                                                                                                    if (e.stopPropagation) {
211
                                                                                                                        e.stopPropagation();
212
                                                                                                                        e.preventDefault();
213
                                                                                                    }
214
                                                                                }
215
                                                            });
216
                                        }
217
218
                                        // Form Handlers =======================================================
219
220
                                        // Required Fields
221
222
                                        function requiredFields() {
223
                                                            $("input:required, textarea:required").each(function (e) {
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
224
                                                                                $(this).parent().addClass("required");
225
                                                                                $(this).parent().find("label").append("<span class='form__required'><i class='fa fa-asterisk' aria-label='Asterisk'></i></span>");
226
                                                            });
227
                                        }
228
229
                                        requiredFields();
230
231
                                        // Label Handers ===================================================
232
233
                                        function labelHandlers() {
234
235
                                                            $("[class*='form__input-wrapper'] input, [class*='form__input-wrapper'] textarea").focusin(function (e) {
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
236
                                                                                $(this).parent().addClass("active");
237
                                                            });
238
239
                                                            $("[class*='form__input-wrapper'] input, [class*='form__input-wrapper'] textarea").focusout(function (e) {
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
240
241
                                                                                // Check for existing value.
242
243
                                                                                if ($(this).val() == "") {
244
                                                                                                    $(this).parent().removeClass("active");
245
                                                                                }
246
247
                                                                                // Check Validity
248
249
                                                                                if ($(this).isValid() == true) {
0 ignored issues
show
Best Practice introduced by
Comparing $(this).isValid() to true using the == operator is not safe. Consider using === instead.
Loading history...
250
251
                                                                                                    if ($(this).val() == "" || $(this).attr("type") == "password") {
252
                                                                                                                        $(this).parent().removeClass("valid");
253
                                                                                                                        $(this).parent().removeClass("invalid");
0 ignored issues
show
Best Practice introduced by
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
254
                                                                                                    } else {
255
                                                                                                                        $(this).parent().addClass("valid");
256
                                                                                                                        $(this).parent().removeClass("invalid");
0 ignored issues
show
Best Practice introduced by
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
257
                                                                                                    }
258
                                                                                } else {
259
260
                                                                                                    if ($(this).attr("type") == "password") {
261
                                                                                                                        return false;
262
                                                                                                    } else {
0 ignored issues
show
Comprehensibility introduced by
else is not necessary here since all if branches return, consider removing it to reduce nesting and make code more readable.
Loading history...
263
                                                                                                                        $(this).parent().addClass("invalid");
264
                                                                                                                        $(this).parent().removeClass("valid");
0 ignored issues
show
Best Practice introduced by
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
265
                                                                                                    }
266
                                                                                }
267
                                                            });
268
                                        }
269
270
                                        labelHandlers();
271
272
                                        //Individualize template attributes
273
                                        function appendToAttributes(parent, attribute, suffix, conditions) {
274
                                                            var selector = "*[" + attribute + "]";
275
276
                                                            //If conditions is set, only modify attributes that also
277
                                                            //satisfy that selector
278
                                                            if (conditions) {
279
                                                                                selector = conditions + selector;
280
                                                            }
281
282
                                                            parent.find(selector).each(function () {
283
                                                                                $(this).attr(attribute, $(this).attr(attribute) + suffix);
284
                                                            });
285
                                        }
286
287
                                        //Return the next unused data-item-id value
288
                                        function getNextItemId(parent) {
289
                                                            var maxId = 0;
290
                                                            parent.find("*[data-item-id]").each(function () {
291
                                                                                var id = parseInt($(this).attr('data-item-id'));
292
                                                                                if (id > maxId) {
293
                                                                                                    maxId = id;
294
                                                                                }
295
                                                            });
296
                                                            return maxId + 1;
297
                                        }
298
299
                                        // Profile List Handlers ===============================================
300
301
                                        // Add Profile Element
302
                                        function addProfileElement(trigger) {
303
304
                                                            // Get Parent
305
                                                            var parent = $(trigger).parents(".profile-list");
306
307
                                                            // Get List Wrapper
308
                                                            var wrapper = parent.find(".profile-element-list");
309
310
                                                            // Set Null to Hidden
311
                                                            parent.find(".profile-null").removeClass("active");
312
313
                                                            // Get Template
314
                                                            var template = parent.find(".profile-element.template").clone();
315
316
                                                            // Remove Template Class
317
                                                            template.removeClass("template");
318
319
                                                            // Get New ID
320
                                                            var newId = getNextItemId(wrapper);
321
322
                                                            template.attr('data-item-id', newId);
323
324
                                                            // Individualize Form IDs and labels
325
                                                            appendToAttributes(template, 'id', '_' + newId);
326
                                                            appendToAttributes(template, 'for', '_' + newId);
327
328
                                                            // Individualize form names, except for submit buttons
329
                                                            appendToAttributes(template, 'name', '[' + newId + ']', ':not([name=submit])');
330
                                                            // Individualize values on submit buttons
331
                                                            appendToAttributes(template, 'value', '[' + newId + ']', '[name=submit]');
332
333
                                                            // Prepend Clone to the Wrapper
334
                                                            wrapper.prepend(template);
335
336
                                                            // Reactivate Required Fields
337
                                                            requiredFields();
338
339
                                                            // Reactivate Labels
340
                                                            labelHandlers();
341
342
                                                            // Reactivate Nested Relatives
343
                                                            loadProfileRelatives();
344
                                        }
345
346
                                        // Click Trigger
347
                                        $(".profile-list__add-element-trigger").on("click", function (e) {
348
349
                                                            // Prevent Default Functions
350
                                                            e.preventDefault();
351
352
                                                            // Add Profile Elements
353
                                                            addProfileElement(this);
354
                                        });
355
356
                                        // Enter Key Trigger
357
                                        $(".profile-list__add-element-trigger").on("keyup", function (e) {
358
359
                                                            if (e.which == 13) {
360
361
                                                                                // Prevent Default Functions
362
                                                                                e.preventDefault();
363
364
                                                                                // Add Profile Elements
365
                                                                                addProfileElement(this);
366
                                                            }
367
                                        });
368
369
                                        // Remove Profile Element
370
371
                                        // Add Profile Relative
372
                                        function addProfileRelative(trigger) {
373
374
                                                            // Get Parent
375
                                                            var parent = $(trigger).parents(".profile-relative-list");
376
377
                                                            // Get List Wrapper
378
                                                            var wrapper = parent.find(".profile-relative-list__wrapper");
379
380
                                                            // Set Null to Hidden
381
                                                            // parent.find(".profile-null").removeClass("active");
382
383
                                                            // Get Template
384
                                                            var template = parent.find(".profile-relative.template").clone();
385
386
                                                            // Remove Template Class
387
                                                            template.removeClass("template");
388
389
                                                            // Edit Form IDs
390
391
                                                            // Tristan, help! x_x
392
393
                                                            // Append Clone to the Wrapper
394
                                                            wrapper.append(template);
395
396
                                                            // Reactivate Required Fields
397
                                                            requiredFields();
398
399
                                                            // Reactivate Labels
400
                                                            labelHandlers();
401
402
                                                            // Reactivate Nested Relatives
403
                                                            loadProfileRelativeDeletion();
404
                                        }
405
406
                                        // Load Function
407
                                        function loadProfileRelatives() {
408
409
                                                            // Click Trigger
410
                                                            $(".profile-relative__add-trigger").off("click");
411
412
                                                            $(".profile-relative__add-trigger").on("click", function (e) {
413
414
                                                                                // Prevent Default Functions
415
                                                                                e.preventDefault();
416
417
                                                                                // Add Profile Relative
418
                                                                                addProfileRelative(this);
419
                                                            });
420
421
                                                            // Enter Key Trigger
422
                                                            $(".profile-relative__add-trigger").off("keyup");
423
424
                                                            $(".profile-relative__add-trigger").on("keyup", function (e) {
425
426
                                                                                if (e.which == 13) {
427
428
                                                                                                    // Prevent Default Functions
429
                                                                                                    e.preventDefault();
430
431
                                                                                                    // Add Profile Relative
432
                                                                                                    addProfileRelative(this);
433
                                                                                }
434
                                                            });
435
                                        }
436
437
                                        loadProfileRelatives();
438
439
                                        // Remove Profile Relative
440
                                        function deleteProfileRelative(trigger) {
441
442
                                                            $(trigger).parents(".profile-relative").remove();
443
                                        }
444
445
                                        // Load Function
446
                                        function loadProfileRelativeDeletion() {
447
448
                                                            // Click Trigger
449
                                                            $(".profile-relative__remove-trigger").on("click", function (e) {
450
451
                                                                                // Prevent Default Functions
452
                                                                                e.preventDefault();
453
454
                                                                                // Delete Profile Relative
455
                                                                                deleteProfileRelative(this);
456
                                                            });
457
458
                                                            // Enter Key Trigger
459
                                                            $(".profile-relative__remove-trigger").on("keyup", function (e) {
460
461
                                                                                if (e.which == 13) {
462
463
                                                                                                    // Prevent Default Functions
464
                                                                                                    e.preventDefault();
465
466
                                                                                                    // Delete Profile Relative
467
                                                                                                    deleteProfileRelative(this);
468
                                                                                }
469
                                                            });
470
                                        }
471
472
                                        loadProfileRelativeDeletion();
473
474
                                        // Experience Handlers =================================================
475
476
                                        // Degrees
477
478
                                        function addDegree(trigger) {
0 ignored issues
show
Unused Code introduced by
The parameter trigger is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
479
480
                                                            // Get Wrapper
481
                                                            var wrapper = $(".application-post__experience-wrapper");
482
483
                                                            // Get Template
484
                                                            var template = $(".application-post__accordion--degree.template").clone();
485
486
                                                            // Get New ID
487
                                                            var newID = parseInt(wrapper.find("[class*='application-post__accordion--']").last().attr("data-experience-id")) + 1;
488
489
                                                            // Remove Template Class
490
                                                            template.removeClass("template");
491
492
                                                            // Assign the New ID
493
                                                            template.attr("data-experience-id", newID);
494
495
                                                            // Edit Form IDs
496
497
                                                            // Degree Type
498
                                                            template.find("[data-form-id*='experience-degree']").find("label").attr("for", "degree" + newID);
499
                                                            template.find("[data-form-id*='experience-degree']").find("select").attr("id", "degree" + newID);
500
501
                                                            // Area of Study
502
                                                            template.find("[data-form-id*='experience-aos']").find("label").attr("for", "areaOfStudy" + newID);
503
                                                            template.find("[data-form-id*='experience-aos']").find("input").attr("id", "areaOfStudy" + newID);
504
505
                                                            // Institution
506
                                                            template.find("[data-form-id*='experience-institution']").find("label").attr("for", "institution" + newID);
507
                                                            template.find("[data-form-id*='experience-institution']").find("input").attr("id", "institution" + newID);
508
509
                                                            // Start Date
510
                                                            template.find("[data-form-id*='experience-start-date']").find("label").attr("for", "startDate" + newID);
511
                                                            template.find("[data-form-id*='experience-start-date']").find("input").attr("id", "startDate" + newID);
512
513
                                                            // End Date
514
                                                            template.find("[data-form-id*='experience-end-date']").find("label").attr("for", "endDate" + newID);
515
                                                            template.find("[data-form-id*='experience-end-date']").find("input").attr("id", "endDate" + newID);
516
517
                                                            // Append Clone to the Wrapper
518
                                                            wrapper.append(template);
519
520
                                                            requiredFields();
521
                                                            labelHandlers();
522
                                        }
523
524
                                        $("#addDegreeButton").on("click", function (e) {
525
526
                                                            e.preventDefault();
527
528
                                                            addDegree(this);
529
                                        });
530
531
                                        $("#addDegreeButton").on("keyup", function (e) {
532
533
                                                            if (e.which == 13) {
534
                                                                                e.preventDefault();
535
                                                                                addDegree(this);
536
                                                            }
537
                                        });
538
539
                                        // Courses
540
541
                                        function addCourse(trigger) {
0 ignored issues
show
Unused Code introduced by
The parameter trigger is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
542
543
                                                            // Get Wrapper
544
                                                            var wrapper = $(".application-post__experience-wrapper");
545
546
                                                            // Get Template
547
                                                            var template = $(".application-post__accordion--course.template").clone();
548
549
                                                            // Get New ID
550
                                                            var newID = parseInt(wrapper.find("[class*='application-post__accordion--']").last().attr("data-experience-id")) + 1;
551
552
                                                            // Remove Template Class
553
                                                            template.removeClass("template");
554
555
                                                            // Assign the New ID
556
                                                            template.attr("data-experience-id", newID);
557
558
                                                            // Edit Form IDs
559
560
                                                            // Course Name
561
                                                            template.find("[data-form-id*='experience-course-name']").find("label").attr("for", "courseName" + newID);
562
                                                            template.find("[data-form-id*='experience-course-name']").find("input").attr("id", "courseName" + newID);
563
564
                                                            // Institution
565
                                                            template.find("[data-form-id*='experience-institution']").find("label").attr("for", "institution" + newID);
566
                                                            template.find("[data-form-id*='experience-institution']").find("input").attr("id", "institution" + newID);
567
568
                                                            // Start Date
569
                                                            template.find("[data-form-id*='experience-start-date']").find("label").attr("for", "startDate" + newID);
570
                                                            template.find("[data-form-id*='experience-start-date']").find("input").attr("id", "startDate" + newID);
571
572
                                                            // End Date
573
                                                            template.find("[data-form-id*='experience-end-date']").find("label").attr("for", "endDate" + newID);
574
                                                            template.find("[data-form-id*='experience-end-date']").find("input").attr("id", "endDate" + newID);
575
576
                                                            // Append Clone to the Wrapper
577
                                                            wrapper.append(template);
578
579
                                                            requiredFields();
580
                                                            labelHandlers();
581
                                        }
582
583
                                        $("#addCourseButton").on("click", function (e) {
584
585
                                                            e.preventDefault();
586
587
                                                            addCourse(this);
588
                                        });
589
590
                                        $("#addCourseButton").on("keyup", function (e) {
591
592
                                                            if (e.which == 13) {
593
                                                                                e.preventDefault();
594
                                                                                addCourse(this);
595
                                                            }
596
                                        });
597
598
                                        // Work
599
600
                                        function addWork(trigger) {
0 ignored issues
show
Unused Code introduced by
The parameter trigger is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
601
602
                                                            // Get Wrapper
603
                                                            var wrapper = $(".application-post__experience-wrapper");
604
605
                                                            // Get Template
606
                                                            var template = $(".application-post__accordion--work.template").clone();
607
608
                                                            // Get New ID
609
                                                            var newID = parseInt(wrapper.find("[class*='application-post__accordion--']").last().attr("data-experience-id")) + 1;
610
611
                                                            // Remove Template Class
612
                                                            template.removeClass("template");
613
614
                                                            // Assign the New ID
615
                                                            template.attr("data-experience-id", newID);
616
617
                                                            // Edit Form IDs
618
619
                                                            // Role
620
                                                            template.find("[data-form-id*='experience-course-name']").find("label").attr("for", "role" + newID);
621
                                                            template.find("[data-form-id*='experience-course-name']").find("input").attr("id", "role" + newID);
622
623
                                                            // Group / Company
624
                                                            template.find("[data-form-id*='experience-institution']").find("label").attr("for", "group" + newID);
625
                                                            template.find("[data-form-id*='experience-institution']").find("input").attr("id", "group" + newID);
626
627
                                                            // Description
628
                                                            template.find("[data-form-id*='experience-description']").find("label").attr("for", "description" + newID);
629
                                                            template.find("[data-form-id*='experience-description']").find("input").attr("id", "description" + newID);
630
631
                                                            // Start Date
632
                                                            template.find("[data-form-id*='experience-start-date']").find("label").attr("for", "startDate" + newID);
633
                                                            template.find("[data-form-id*='experience-start-date']").find("input").attr("id", "startDate" + newID);
634
635
                                                            // End Date
636
                                                            template.find("[data-form-id*='experience-end-date']").find("label").attr("for", "endDate" + newID);
637
                                                            template.find("[data-form-id*='experience-end-date']").find("input").attr("id", "endDate" + newID);
638
639
                                                            // Append Clone to the Wrapper
640
                                                            wrapper.append(template);
641
642
                                                            requiredFields();
643
                                                            labelHandlers();
644
                                        }
645
646
                                        $("#addWorkButton").on("click", function (e) {
647
648
                                                            e.preventDefault();
649
650
                                                            addWork(this);
651
                                        });
652
653
                                        $("#addWorkButton").on("keyup", function (e) {
654
655
                                                            if (e.which == 13) {
656
                                                                                e.preventDefault();
657
                                                                                addWork(this);
658
                                                            }
659
                                        });
660
661
                                        // Create Job Handlers =================================================
662
663
                                        // Tasks
664
665
                                        function addTask(trigger) {
0 ignored issues
show
Unused Code introduced by
The parameter trigger is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
666
667
                                                            // Get Wrapper
668
                                                            var wrapper = $(".manager-jobs__create-task-wrapper");
669
670
                                                            // Get Template
671
                                                            var template = $(".manager-jobs__create-task.template").clone();
672
673
                                                            console.log(wrapper.find(".manager-jobs__create-task"));
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
674
675
                                                            // Get New ID
676
                                                            if (wrapper.find(".manager-jobs__create-task").length == 0) {
0 ignored issues
show
Best Practice introduced by
Comparing wrapper.find(".manager-jobs__create-task").length to 0 using the == operator is not safe. Consider using === instead.
Loading history...
677
                                                                                var newID = parseInt(template.attr("data-task-id")) + 1;
678
                                                            } else {
679
                                                                                var newID = parseInt(wrapper.find("[class*='manager-jobs__create-task']").last().attr("data-task-id")) + 1;
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable newID already seems to be declared on line 677. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
680
                                                            }
681
682
                                                            // Remove Template Class
683
                                                            template.removeClass("template");
684
685
                                                            // Assign the New ID
686
                                                            template.attr("data-task-id", newID);
687
688
                                                            // Add newID as suffix to all "id" and "for" attributes
689
                                                            template.find("*[id]").each(function () {
690
                                                                                $(this).attr("id", this.id + newID);
691
                                                            });
692
                                                            template.find("*[for]").each(function () {
693
                                                                                $(this).attr("for", $(this).attr("for") + newID);
694
                                                            });
695
696
                                                            // Replace :id with newID in all form names
697
                                                            template.find("*[name]").each(function () {
698
                                                                                $(this).attr('name', $(this).attr("name").replace(":id", newID));
699
                                                            });
700
701
                                                            // Task (English)
702
                                                            //template.find("[data-form-id*='task-english']").find("label").attr("for", "taskEN" + newID);
703
                                                            //template.find("[data-form-id*='task-english']").find("input").attr("id", "taskEN" + newID);
704
705
                                                            // Task (French)
706
                                                            //template.find("[data-form-id*='task-french']").find("label").attr("for", "taskFR" + newID);
707
                                                            //template.find("[data-form-id*='task-french']").find("input").attr("id", "taskFR" + newID);
708
709
                                                            // Append Clone to the Wrapper
710
                                                            wrapper.append(template);
711
712
                                                            requiredFields();
713
                                                            labelHandlers();
714
                                                            deleteTaskTrigger();
715
                                        }
716
717
                                        $("#addTaskButton").on("click", function (e) {
718
719
                                                            e.preventDefault();
720
721
                                                            addTask(this);
722
                                        });
723
724
                                        $("#addTaskButton").on("keyup", function (e) {
725
726
                                                            if (e.which == 13) {
727
                                                                                e.preventDefault();
728
                                                                                addTask(this);
729
                                                            }
730
                                        });
731
732
                                        // Task Deletion
733
734
                                        function deleteTask(trigger) {
735
736
                                                            $(trigger).parents(".manager-jobs__create-task").remove();
737
                                        }
738
739
                                        function deleteTaskTrigger() {
740
741
                                                            $(".manager-jobs__delete-task-button").on("click", function (e) {
742
743
                                                                                e.preventDefault();
744
745
                                                                                deleteTask(this);
746
                                                            });
747
748
                                                            $(".manager-jobs__delete-task-button").on("keyup", function (e) {
749
750
                                                                                if (e.which == 13) {
751
                                                                                                    e.preventDefault();
752
                                                                                                    deleteTask(this);
753
                                                                                }
754
                                                            });
755
                                        }
756
757
                                        deleteTaskTrigger();
758
759
                                        // Skills
760
761
                                        function addSkill(trigger) {
762
763
                                                            // Get Parent
764
                                                            var parent = $(trigger).parents(".manager-jobs__skill-wrapper");
765
766
                                                            // Get Wrapper
767
                                                            var wrapper = parent.find(".manager-jobs__create-skill-wrapper");
768
769
                                                            // Get Template
770
                                                            var template = parent.find(".manager-jobs__create-skill.template").clone();
771
772
                                                            console.log(wrapper.find(".manager-jobs__create-skill"));
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
773
774
                                                            // Get New ID
775
                                                            if (wrapper.find(".manager-jobs__create-skill").length == 0) {
0 ignored issues
show
Best Practice introduced by
Comparing wrapper.find(".manager-j...__create-skill").length to 0 using the == operator is not safe. Consider using === instead.
Loading history...
776
                                                                                var newID = parseInt(template.attr("data-skill-id")) + 1;
777
                                                            } else {
778
                                                                                var newID = parseInt(wrapper.find("[class*='manager-jobs__create-skill']").last().attr("data-skill-id")) + 1;
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable newID already seems to be declared on line 776. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
779
                                                            }
780
781
                                                            // Remove Template Class
782
                                                            template.removeClass("template");
783
784
                                                            // Assign the New ID
785
                                                            template.attr("data-skill-id", newID);
786
787
                                                            // Add newID as suffix to all "id" and "for" attributes
788
                                                            template.find("*[id]").each(function () {
789
                                                                                $(this).attr("id", this.id + newID);
790
                                                            });
791
                                                            template.find("*[for]").each(function () {
792
                                                                                $(this).attr("for", $(this).attr("for") + newID);
793
                                                            });
794
795
                                                            // Replace :id with newID in all form names
796
                                                            template.find("*[name]").each(function () {
797
                                                                                $(this).attr('name', $(this).attr("name").replace(":id", newID));
798
                                                            });
799
800
                                                            // Edit Form IDs
801
                                                            //
802
                                                            // // Queestion (English)
803
                                                            // template.find("[data-form-id*='question-english']").find("label").attr("for", "questionEN" + newID);
804
                                                            // template.find("[data-form-id*='question-english']").find("input").attr("id", "questionEN" + newID);
805
                                                            //
806
                                                            // // Queestion (French)
807
                                                            // template.find("[data-form-id*='question-french']").find("label").attr("for", "questionFR" + newID);
808
                                                            // template.find("[data-form-id*='question-french']").find("input").attr("id", "questionFR" + newID);
809
810
                                                            // Append Clone to the Wrapper
811
                                                            wrapper.append(template);
812
813
                                                            requiredFields();
814
                                                            labelHandlers();
815
                                                            deleteSkillTrigger();
816
                                        }
817
818
                                        $(".manager-jobs__add-skill-button").on("click", function (e) {
819
820
                                                            e.preventDefault();
821
822
                                                            addSkill(this);
823
                                        });
824
825
                                        $(".manager-jobs__add-skill-button").on("keyup", function (e) {
826
827
                                                            if (e.which == 13) {
828
                                                                                e.preventDefault();
829
                                                                                addSkill(this);
830
                                                            }
831
                                        });
832
833
                                        // Skill Deletion
834
835
                                        function deleteSkill(trigger) {
836
837
                                                            $(trigger).parents(".manager-jobs__create-skill").remove();
838
                                        }
839
840
                                        function deleteSkillTrigger() {
841
842
                                                            $(".manager-jobs__delete-skill-button").on("click", function (e) {
843
844
                                                                                e.preventDefault();
845
846
                                                                                deleteSkill(this);
847
                                                            });
848
849
                                                            $(".manager-jobs__delete-skill-button").on("keyup", function (e) {
850
851
                                                                                if (e.which == 13) {
852
                                                                                                    e.preventDefault();
853
                                                                                                    deleteSkill(this);
854
                                                                                }
855
                                                            });
856
                                        }
857
858
                                        deleteSkillTrigger();
859
860
                                        // Questions
861
862
                                        function addQuestion(trigger) {
0 ignored issues
show
Unused Code introduced by
The parameter trigger is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
863
864
                                                            // Get Wrapper
865
                                                            var wrapper = $(".manager-jobs__create-question-wrapper");
866
867
                                                            // Get Template
868
                                                            var template = $(".manager-jobs__create-question.template").clone();
869
870
                                                            console.log(wrapper.find(".manager-jobs__create-question"));
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
871
872
                                                            // Get New ID
873
                                                            if (wrapper.find(".manager-jobs__create-question").length == 0) {
0 ignored issues
show
Best Practice introduced by
Comparing wrapper.find(".manager-j...reate-question").length to 0 using the == operator is not safe. Consider using === instead.
Loading history...
874
                                                                                var newID = parseInt(template.attr("data-question-id")) + 1;
875
                                                            } else {
876
                                                                                var newID = parseInt(wrapper.find("[class*='manager-jobs__create-question']").last().attr("data-question-id")) + 1;
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable newID already seems to be declared on line 874. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
877
                                                            }
878
879
                                                            // Remove Template Class
880
                                                            template.removeClass("template");
881
882
                                                            // Assign the New ID
883
                                                            template.attr("data-question-id", newID);
884
885
                                                            // Add newID as suffix to all "id" and "for" attributes
886
                                                            template.find("*[id]").each(function () {
887
                                                                                $(this).attr("id", this.id + newID);
888
                                                            });
889
                                                            template.find("*[for]").each(function () {
890
                                                                                $(this).attr("for", $(this).attr("for") + newID);
891
                                                            });
892
893
                                                            // Replace :id with newID in all form names
894
                                                            template.find("*[name]").each(function () {
895
                                                                                $(this).attr('name', $(this).attr("name").replace(":id", newID));
896
                                                            });
897
898
                                                            // Edit Form IDs
899
                                                            //
900
                                                            // // Queestion (English)
901
                                                            // template.find("[data-form-id*='question-english']").find("label").attr("for", "questionEN" + newID);
902
                                                            // template.find("[data-form-id*='question-english']").find("input").attr("id", "questionEN" + newID);
903
                                                            //
904
                                                            // // Queestion (French)
905
                                                            // template.find("[data-form-id*='question-french']").find("label").attr("for", "questionFR" + newID);
906
                                                            // template.find("[data-form-id*='question-french']").find("input").attr("id", "questionFR" + newID);
907
908
                                                            // Append Clone to the Wrapper
909
                                                            wrapper.append(template);
910
911
                                                            requiredFields();
912
                                                            labelHandlers();
913
                                                            deleteQuestionTrigger();
914
                                        }
915
916
                                        $("#addQuestionButton").on("click", function (e) {
917
918
                                                            e.preventDefault();
919
920
                                                            addQuestion(this);
921
                                        });
922
923
                                        $("#addQuestionButton").on("keyup", function (e) {
924
925
                                                            if (e.which == 13) {
926
                                                                                e.preventDefault();
927
                                                                                addQuestion(this);
928
                                                            }
929
                                        });
930
931
                                        // Question Deletion
932
933
                                        function deleteQuestion(trigger) {
934
935
                                                            $(trigger).parents(".manager-jobs__create-question").remove();
936
                                        }
937
938
                                        function deleteQuestionTrigger() {
939
940
                                                            $(".manager-jobs__delete-question-button").on("click", function (e) {
941
942
                                                                                e.preventDefault();
943
944
                                                                                deleteQuestion(this);
945
                                                            });
946
947
                                                            $(".manager-jobs__delete-question-button").on("keyup", function (e) {
948
949
                                                                                if (e.which == 13) {
950
                                                                                                    e.preventDefault();
951
                                                                                                    deleteQuestion(this);
952
                                                                                }
953
                                                            });
954
                                        }
955
956
                                        deleteQuestionTrigger();
957
                    });
958
})(jQuery);
959
960
/***/ }),
961
/* 1 */,
0 ignored issues
show
Bug introduced by
The variable seems to be never declared. If this is a global, consider adding a /** global: */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
962
/* 2 */,
963
/* 3 */
964
/***/ (function(module, exports) {
0 ignored issues
show
Unused Code introduced by
The parameter module is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter exports is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
965
966
// removed by extract-text-webpack-plugin
967
968
/***/ }),
969
/* 4 */
970
/***/ (function(module, exports, __webpack_require__) {
971
972
__webpack_require__(0);
973
module.exports = __webpack_require__(3);
974
975
976
/***/ })
977
/******/ ]);